/*
 * zcdModal_main.js
 * 中尺度
 */
;
(function (call) {
    var main = {
        router: {
           
        },
        init: function () {
            this.initView();
        },
        bindEvt: function () {
           
        },
        initView: function () {
           ZHONGCHIDU.init();
           TIANQICHIDU.init();
        }
    };
    if (typeof call === 'function') {
        call(main);
    }
})(function (main) {
    main.init();
});
var draw;
	draw=new G.Draw('drawSvg');
	GLMap.addLayer(draw);
function scaleClick(value) {
    debugger
    if(!GLMap.getLayer("drawSvg")){
        draw=new G.Draw('drawSvg');
        GLMap.addLayer(draw);
    }
    var _this = $this = $(value);
    $(".chooseName").text(_this.attr("title"));
    //选中颜色R
    var color = _this.attr("style").split(":")[1];

    _this.color = color;
    //drawSvgGis.svg.RGBToHex(_this);
    //选中样式
    var style = _this.attr("selfDefineStyle");
    if (style != undefined) {
        $("#svgselect").val(style);
    }

     //高度层是否可选
    if (_this.attr('hPadisabled') == "false") {
        $('#hPaselect').attr({'disabled': false});
    } else{
        $('#hPaselect').attr({'disabled': true});
    }
    //选中高度层
    var hPa = _this.attr("DefinehPa");
    if (hPa != undefined) {
        $("#hPaselect").val(hPa);
    }

    $('.scale_method').css('backgroundImage', '');
    if ($this.hasClass('scale_method')) {

        $this.css({'backgroundImage': 'linear-gradient(to right, #293956 0%, #3F5361 50%)'});
    }
    ;
    //if (navToolbar) {
    //	navToolbar.deactive();
    //}
    var objSvgImage = {};
    objSvgImage.color = value.style.color;
    //objSvgImage.fillColor = value.getAttribute('fillColor');
    objSvgImage.fill = value.style.color;
    //objSvgImage.fillCo=value.getAttribute('fillCo');
    objSvgImage.style = value.getAttribute('selfdefinestyle');
    objSvgImage.id = value.getAttribute('id');
    if(value.id2)  objSvgImage.id2 = value.getAttribute('id2');
    objSvgImage.type = value.getAttribute('type');
    objSvgImage.typeTrue = value.getAttribute('typeTrue') || '';
    //objSvgImage.selfdisabled = value.getAttribute('selfdisabled') || '';
    //objSvgImage.selfDefineStyle = value.getAttribute('selfDefineStyle') || '';
    objSvgImage["stroke-width"] = value.getAttribute('selfdefinewidth') ||4;
    //objSvgImage.strokeColor = value.getAttribute('strokeColor') || '';
    objSvgImage.stroke = value.getAttribute('strokeColor') || value.style.color;
    objSvgImage.biaozhu = value.getAttribute('biaozhu') || '';

    objSvgImage["stroke-dasharray"] = G.SvgSymbol.getLineStyle(objSvgImage.style);

    // if(GIS&&GIS.Common&&GIS.Common.drawWeatherSystem){
    // 	var $mapDivs = $(".esriControlsBR").parent().parent(),cid;
    // 	for(var divs=0;divs<$mapDivs.length;divs++){
    // 		if($mapDivs.eq(divs).css('display')!='none'){
    // 			cid=$mapDivs.eq(divs).attr("id");
    // 			break;
    // 		}
    // 	}
    // 	GIS.Common.drawWeatherSystem(cid,objSvgImage);
    // }else{
    // 	drawSvgGis.svg.gis(objSvgImage);
    // }
    debugger
    // drawSvgGis.svg.changeWidth(objSvgImage, $this);

    //设置显示初始线宽
    var w = $('.scale_size').innerWidth();
    if (objSvgImage.typetrue == "zdfd" || objSvgImage.typetrue == "JIANTOU" || objSvgImage.typetrue == "zdfd2") {
        $('.size_move').css('left', (objSvgImage["stroke-width"]/2 - 1) / 4 * w);
    } else {
        $('.size_move').css('left', (objSvgImage["stroke-width"] - 1) / 4 * w);
    }

    var type = "bezierPolyline";
    if (objSvgImage.type == "POLYLINE") {
        type = "polyline";
    } else if (objSvgImage.type == "WIND") {
        type = "wind";
    } else if (objSvgImage.type == "POINT") {
        type = "point";
        objSvgImage["fill-opacity"] = 1;
    } else if (objSvgImage.type == "BEZIER_POLYGON") {
        type = "bezierPolygon";
        objSvgImage["fill-opacity"] = 1;
    }
    GLMap.disablePan();

    let options={
        clickStyle:{
            leftClickColor:"red",
            rightClickColor:"blue"
        }
    };
    debugger
    draw.startDraw(type,objSvgImage,null,options);
}
function pan(){
    draw.endDraw();
    GLMap.enablePan();
}